<include file="Public:header"/>

<form action="" method="post" class="ajax-form">
<section class="bd bd_p0">		
	<div class="member">
		<div class="user_header">
			<p class="writing_high">米律-专为创业者而生</p>
		</div>
		<div class="account_info">
			<ul id="j_detail_account" class="detail_account">
				<li>
					<span class="title">登陆密码</span>
					<div class="info">
						<input type="password" name="password" placeholder="请输入登陆密码" datatype="*">
					</div>
				</li>
				<li>
					<span class="title">手机号</span>
					<div class="info">
						<input type="text" name="mobile" class="mobile" placeholder="请输入新的手机号" autocomplete="off" datatype="mobile">
					</div>
				</li>
				<li>
					<span class="title">图片验证码</span>
					<div class="info">
						<input type="text" name="imgcode" class="imgcode" placeholder="请输入验证码" autocomplete="off">
						<a href="javascript:;" class="nojump">
							<img class="img-verify" href="{:U('Login/imgcode', 'w=126&h=38')}" src="{:U('Login/imgcode', 'w=126&h=38')}" width="60" />
						</a>
					</div>
				</li>
				<li>
					<span class="title">短信验证码</span>
					<div class="info">
						<input type="text" name="smscode" class="smscode" placeholder="短信验证码" autocomplete="off" datatype="*">
						<a class="get-smscode">获取验证码</a>
						<a class="show-time" style="display: none"><span>60</span>s</a>
					</div>
				</li>
				
			</ul>
			<input type="submit" name="" value="保存" class="btn" />
		</div>
	</div>
</section>
</form>

<style type="text/css">
.main{
	background-color: #FFF;
}
.account_info li span{
	width: 3.6rem;
}
.account_info li input{
	width: 120px;
}
</style>
<script type="text/javascript">
$(document).ready(function(){
	$('.img-verify').click(function () {
		var url = $(this).attr('href') + '?' + Math.random();
		$(this).attr('src', url);
		return false;
	});
	//获取验证码
	$('.get-smscode').click(function () {
		var mobile  = $('input[name="mobile"]').val();
		var imgcode = $('input[name="imgcode"]').val();
		if(!mobile){
			msgbox('手机号不能为空！', 'error');
			return false;
		}
		if(!imgcode){
			msgbox('图片验证码不能为空！', 'error');
			return false;
		}
		loading('获取验证码中...');
		$.ajax({
			type: "get",
			url: "{:U('get_smscode')}",
			data: 'type=forget_password&mobile=' + mobile + '&imgcode=' + imgcode,
			dataType: "json",
			success: function(data){
				removeLoading();
				if(data.status == 1){
					$('.get-smscode').hide();
					$('.smscode-time').css('display', 'inline-block').find('span').text(60);
					msgbox(data.info);
					var wait = $('.smscode-time span');
					var smscode_interval = setInterval(function(){
						var time = wait.text();
							--time;
							wait.text(time);
						if(time == 0) {
							$('.smscode-time').hide();
							$('.get-smscode').show();
							clearInterval(smscode_interval);
						};
					}, 1000);
				}else{
					msgbox(data.info, 'error');
				}
			},
			error : function () {
				removeLoading();
				msgbox('请求失败！', 'error');
			}
		});
	});
})
</script>
<include file="Public:footer"/>